<?php

class view_detail extends a_front_controller {

    private $objProd_from_products;
    private $objProd_from_dimension;
    private $objProd_from_languages;
    private $objProd_from_images;
    private $srv;

    public function __construct() {
        parent::__construct(true);
        $this->srv = new service_l_product();
    }

    public function id($prod_id)
    {
        //@TO_DO : warehouse filtering that might comefrom session or global settings
       $this->objProd_from_products = new product_m_product();
       $this->objProd_from_products->where("id", $prod_id);
       $this->objProd_from_products->where("is_deleted", "0");

       // how do i check if there aree any products 
       if($this->objProd_from_products != NULL)
       {
           $this->objProd_from_products->get();

           $this->objProd_from_dimension = $this->srv->create_dimension_object($prod_id);
           $this->objProd_from_languages =$this->srv->create_prod_lang_object($prod_id);
           $this->objProd_from_images = $this->srv->create_prod_image_object($prod_id);
       }
       else
       {
           error_log("Product not found");
       }
    }

    public function batch_assign(){
        $this->assign("product_obj", $this->objProd_from_products);
        $this->assign("dimension_obj", $this->objProd_from_dimension);
        $this->assign("language_obj", $this->objProd_from_languages);
        $this->assign("image_obj", $this->objProd_from_images);
        
    }

    public function index() {
    }
 }
?>